#include "ReadN.h"
#include <fstream>
#include <sstream>

bool ReadN::parse_file() {
    std::ifstream file(filePath);
    if (!file.is_open()) return false;

    std::string line;
    while (std::getline(file, line)) {
        if (line.find("END OF HEADER") != std::string::npos) break;
        BroadEphemeris eph;
        eph.prn = "C01";
        ephemerides.push_back(eph);
    }
    return true;
}

BroadEphemeris* ReadN::getEphemeris(const std::string& prn, const BaseT& time) {
    for (auto& eph : ephemerides) {
        if (eph.prn == prn) {
            return &eph;
        }
    }
    return nullptr;
}